package com.qf.servlet;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author bss
 * @version V1.0
 * @Project 02Day01
 * @Package com.qf.servlet
 * @Description:
 * @Date 2022/9/5 10:17
 */
@WebServlet("/test")
public class TestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setAttribute("key","请求域的数据");
//        RequestDispatcher rd = req.getRequestDispatcher("/view");
//        rd.forward(req,resp);

        resp.sendRedirect("/02servlet01_war_exploded/view");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
